package com.ruoyi.home.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.home.mapper.HomeBannerMapper;
import com.ruoyi.home.domain.HomeBanner;
import com.ruoyi.home.service.IHomeBannerService;

/**
 * 首页轮播图Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-23
 */
@Service
public class HomeBannerServiceImpl implements IHomeBannerService 
{
    @Autowired
    private HomeBannerMapper homeBannerMapper;

    /**
     * 查询首页轮播图
     * 
     * @param bannerId 首页轮播图主键
     * @return 首页轮播图
     */
    @Override
    public HomeBanner selectHomeBannerByBannerId(Long bannerId)
    {
        return homeBannerMapper.selectHomeBannerByBannerId(bannerId);
    }

    /**
     * 查询首页轮播图列表
     * 
     * @param homeBanner 首页轮播图
     * @return 首页轮播图
     */
    @Override
    public List<HomeBanner> selectHomeBannerList(HomeBanner homeBanner)
    {
        return homeBannerMapper.selectHomeBannerList(homeBanner);
    }

    /**
     * 新增首页轮播图
     * 
     * @param homeBanner 首页轮播图
     * @return 结果
     */
    @Override
    public int insertHomeBanner(HomeBanner homeBanner)
    {
        homeBanner.setCreateTime(DateUtils.getNowDate());
        return homeBannerMapper.insertHomeBanner(homeBanner);
    }

    /**
     * 修改首页轮播图
     * 
     * @param homeBanner 首页轮播图
     * @return 结果
     */
    @Override
    public int updateHomeBanner(HomeBanner homeBanner)
    {
        homeBanner.setUpdateTime(DateUtils.getNowDate());
        return homeBannerMapper.updateHomeBanner(homeBanner);
    }

    /**
     * 批量删除首页轮播图
     * 
     * @param bannerIds 需要删除的首页轮播图主键
     * @return 结果
     */
    @Override
    public int deleteHomeBannerByBannerIds(Long[] bannerIds)
    {
        return homeBannerMapper.deleteHomeBannerByBannerIds(bannerIds);
    }

    /**
     * 删除首页轮播图信息
     * 
     * @param bannerId 首页轮播图主键
     * @return 结果
     */
    @Override
    public int deleteHomeBannerByBannerId(Long bannerId)
    {
        return homeBannerMapper.deleteHomeBannerByBannerId(bannerId);
    }
}
